package com.scedu.exception;

import com.scedu.result.ResultCode;
import lombok.Getter;
import lombok.Setter;

/*
异常类 不要继承Exception
 */
@Getter
@Setter
public class CommonException extends RuntimeException{
    private  Integer code; //错误代码
    private String msg; //错误提示

    public CommonException(ResultCode resultCode) {
        super(resultCode.getMessage()); //把msg传到父类的构造方法中去  RuntimeException(String message)
        this.code = resultCode.getCode();
        this.msg=resultCode.getMessage();
    }

    public CommonException(Integer code,String message) {
        super(message);
        this.code = code;
        this.msg=message;
    }

}
